package com.starblink.android.common.route

import android.content.Context
import com.alibaba.android.arouter.facade.annotation.Route
import com.alibaba.android.arouter.facade.service.SerializationService
import com.blankj.utilcode.util.GsonUtils
import java.lang.reflect.Type

@Route(path = "/common/json")
class SkSerializeServiceImp: SerializationService {
    override fun init(context: Context?) {

    }

    override fun <T : Any?> json2Object(input: String?, clazz: Class<T>): T {
        return GsonUtils.fromJson(input, clazz)
    }

    override fun object2Json(instance: Any?): String {
        return GsonUtils.toJson(instance)
    }

    override fun <T : Any?> parseObject(input: String?, clazz: Type): T {
        return GsonUtils.fromJson(input, clazz)
    }
}